<script>
	import routerlimit from 'utils/auth.js'
export default {
	onLaunch: function () {
		console.log("App Launch")
		routerlimit()
		let that = this
		uni.getSetting({
			success(res) {
				console.log(res, res)
				// 如果没有授权
				if (!res.authSetting["scope.userLocation"]) {
					// 则拉起授权窗口
					uni.authorize({
						scope: "scope.userLocation",
						success() {
							uni.getLocation({
								type: "wgs84",
								success: function (res) {
									console.log("当前位置的经度：" + res.longitude)
									console.log("当前位置的纬度：" + res.latitude)
								},
							})
						},
						fail(error) {
							//点击了拒绝授权后--就一直会进入失败回调函数--此时就可以在这里重新拉起授权窗口
							console.log("拒绝授权", error)

							uni.showModal({
								title: "提示",
								content: "若不授权地理位置，小程序部分功能将无法正常使用",
								cancelText: "不授权",
								cancelColor: "#999",
								confirmText: "授权",
								confirmColor: "#F94D29",
								success(res) {
									console.log(res)
									if (res.confirm) {
										// 选择弹框内授权
										uni.openSetting({
											success(res) {
												console.log(res.authSetting)
											},
										})
									} else if (res.cancel) {
										// 选择弹框内 不授权
										console.log("用户点击不授权")
									}
								},
							})
						},
					})
				} else {
					console.log("getLocation")
				}
			},
		})
	},
	onShow: function () {
		console.log("App Show")
	},
	onHide: function () {
		console.log("App Hide")
	},
}
</script>

<style lang="scss">
@import "uview-ui/index.scss";
$primary-color: #ff3b26;
.column-container {
	display: flex;
	flex-direction: column;
}
/*每个页面公共css */
.p-20 {
	padding: 20rpx;
}
.flex {
	display: flex;
}
.flex-1 {
	flex: 1;
}
.jus-b {
	justify-content: space-between;
}
.ali-c {
	align-items: center;
}
.text-center {
	text-align: center;
}
.border-b {
	border-bottom: 1px solid #eee;
}
.text-primary {
	color: #ff3b26;
}
.text-sm {
	font-size: 26rpx;
}
.text-lg {
	font-size: 32rpx !important;
}
.text-bold {
	font-weight: bold;
}
.text-gray {
	color: #6c6c6c;
}
.text-black {
	color: #000 !important;
}
.text-white {
	color: #fff !important;
}
.flex-col {
	flex-direction: column;
}
.gap-10 {
	gap: 10rpx;
}
.mt-10 {
	margin-top: 10rpx;
}
.border-r {
	border-right: 1px solid #eee;
}
.bg-white {
	background-color: #fff;
}
.mt-20 {
	margin-top: 20rpx;
}
.line-two {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
}
.mx-10{
	margin-left: 10rpx;
	margin-right: 10rpx;
}
.ml-20 {
	margin-left: 20rpx;
}
.ml-10{
	margin-left: 10rpx;
}
.box-shadow {
	box-shadow: 0 0 10rpx #eee;
}
.radius-sm {
	border-radius: 5rpx;
}
.radius-md {
	border-radius: 10rpx;
}
.radius-lg {
	border-radius: 20rpx;
}
.bg-primary {
	background-color: $primary-color;
}

.flex-end {
	justify-content: flex-end;
}
/*每个页面公共css */
page {
	background: #f7f7f7;
}
.py-30{
	padding-top: 30rpx;
	padding-bottom: 30rpx;
}

.pt-30p{
	padding-top: 30%;
}

/*每个页面公共css */
.flex {
	display: flex;
}

.ali-c {
	align-items: center;
}

.ml-10 {
	margin-left: 10rpx;
}

.one-line {
	overflow: hidden;
	/*line-height: 15px;*/
	text-overflow: ellipsis;
	display: -webkit-box;
	/*重新定义-webkit私有盒模型*/
	-webkit-box-orient: vertical;
	/*内容之间的排列顺序，vertical垂直方向排列*/
	-webkit-line-clamp: 1;
	/*在第几行末尾显示省略号...*/
	word-break: break-all;
}

.jus-b {
	justify-content: space-between;
}

.jus-c {
	justify-content: center;
}
</style>
